from flask import Flask
from flask import request, jsonify
from flask_restful import Api 
from flask_script import Manager
from flask_cors import CORS
from nosql import diarys,users,login 

app = Flask(__name__)
CORS(app)
# manager = Manager(app)
api = Api(app)

api.add_resource(diarys.DiaryList, '/logs')
api.add_resource(diarys.DiaryToday, '/logs/<user>/<day>')
api.add_resource(diarys.DiaryUser, '/logs/<user>')
api.add_resource(diarys.DiaryDay, '/logs/<day>')
api.add_resource(diarys.LogList, '/logs/<id>')

api.add_resource(users.Users, '/users')
api.add_resource(users.User, '/user/<name>')

api.add_resource(login.Login, '/login')
api.add_resource(login.Token, '/login/<token>')

if __name__ == '__main__':
    # manager.run()
    app.run(host='0.0.0.0')

